<include file="public:header" />
<include file="public:left" />
<style>
    td{text-align:center;}
</style>
<section>
    <div class="page_title">
        <h2 class="fl">轮播图</h2>
        <a class="fr" href="{:url('set/banner_edit')}">新增banner图</a>
    </div>
    <table class="table">
        <tr>
            <th>id</th>
            <th>标题</th>
            <th>图片</th>
            <th>状态</th>
            <th>顺序</th>
            <th>操作</th>
        </tr>
        <volist name="res" id="vo">
            <tr>
                <td  ><div class="cut_title ellipsis">{$vo.id}</div></td>
                <td>{$vo.title}</td>
                <td><img src="__STATIC__/uploads/{$vo.pic}" style="width: 80px;height: 80px;"></td>
                <td><eq name="vo.status" value="0">弃用<else />启用</eq></td>
                <td>{$vo.displayorder}</td>
                <td align="center" class="handle">
                    <div style="text-align: center; width: 170px; max-width:170px;">
                        <a href="{:url('set/banner_edit',array('id'=>$vo['id']))}" class="btn blue"><i class="fa fa-pencil-square-o"></i>编辑</a>
                        <a class="btn red delbanner"  href="javascript:void(0)" id="{$vo.id}" ><i class="fa fa-trash-o"></i>删除</a>
                    </div>
                </td>
            </tr>
        </volist>

    </table>


</section>

<!--tabStyle-->
<script>
    $(document).ready(function(){
        //tab
        $(".admin_tab li a").click(function(){
            var liindex = $(".admin_tab li a").index(this);
            $(this).addClass("active").parent().siblings().find("a").removeClass("active");
            $(".admin_tab_cont").eq(liindex).fadeIn(150).siblings(".admin_tab_cont").hide();
        });
    });

    $(".delbanner").click(function(){
        // 删除按钮
        var id = $(this).attr('id');
        layer.confirm('删除数据无法恢复，并且会影响用户数据，确定删除？', {
            btn: ['确定', '取消']
        }, function() {
            $.post("{:url('set/banner_del')}", {id: id}, function (result) {

                if (result.code == '0') {
                    layer.alert(result.msg);
                } else {
                    layer.alert(result.msg, {
                                btn: ['确定']
                            },
                            function (index, item) {
                                //layer.close(index);
                                location.reload();
                            });
                }
            });
        });
    });
</script>


</div>
</section>
</body>
</html>
